package org.andcool.animation.ease;

import android.view.animation.Interpolator;

/**
 * @author Joosun
 * @since 2011-5-8
 */
public abstract class BaseEase implements Interpolator
{
	private EasingMode mEasingMode;

	public BaseEase(final EasingMode pEasingMode)
	{
		this.mEasingMode = pEasingMode;
	}

	@Override
	public float getInterpolation(final float pPercentage)
	{
		if (this.mEasingMode.equals(EasingMode.EASE_IN))
		{
			return this.getEaseInInterpolation(pPercentage);
		}
		else if (this.mEasingMode.equals(EasingMode.EASE_OUT))
		{
			return this.getEaseOutInterpolation(pPercentage);
		}
		else if (this.mEasingMode.equals(EasingMode.EASE_IN_OUT))
		{
			return this.getEaseInOutInterpolation(pPercentage);
		}

		return 0;
	}

	protected abstract float getEaseInInterpolation(final float pPercentage);

	protected abstract float getEaseOutInterpolation(final float pPercentage);

	protected abstract float getEaseInOutInterpolation(final float pPercentage);
}